
 
package Main;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Level extends JPanel 
{
	private int theLevel;
	
	public Level(int levelNum, final Session s) 
	{
		theLevel = levelNum;
		setBorder(BorderFactory.createLineBorder(Color.blue));
		this.addKeyListener(new KeyListener() 
		{
			public void keyTyped(KeyEvent e) {}
			public void keyPressed(KeyEvent e){}
			public void keyReleased(KeyEvent e) 
			{
				if (e.getKeyCode() == KeyEvent.VK_ENTER) 
				{
					s.startGamePlay();
				}
			}
		});
	}
	

	
	public void paintComponent(Graphics g) 
	{
		int width = this.getWidth();
		int height = this.getHeight();
		Graphics2D g2 = (Graphics2D) g;
		g2.setColor(Color.DARK_GRAY);
		g2.fill3DRect(0, 0, width, height, true);
		//gradient..
		for (int x = 1; x < height; x++) 
		{
			int c = (int) (((double) x / height) * 255.0);
			g2.setColor(new Color(c/2, c/2, c/2+30));
			g2.drawLine(0, x, width, x);
		}
		
		//setting for text
		g2.setFont(new Font("Arial", Font.BOLD, 150));
		g2.setColor(Color.BLACK);
		//gradient text
		for (int x = 1; x < 8; x++) 
		{
			int c = (int) (255 - ((double) x / 8) * 255.0);
			g2.setColor(new Color(c/2,c/2,c/2));
			g2.drawString("Level " + theLevel, 900/2 - 260 + x, (height / 2)+ 50 + x);
		}
		
		g2.setColor(new Color(110,110,220));
		g2.setFont(new Font("Times New Roman", Font.BOLD, 28));
		g2.drawString("Press Enter to Continue", 900/2-140, 500);
		g2.setColor(new Color(240,240,255));
		g2.drawString("Press Enter to Continue", 900/2-138, 502);
		this.setEnabled(true);
		this.setFocusable(true);
		this.requestFocus();
	}
}
